package android.coocoo.models;

import android.coocoo.common.Const;
import android.os.Parcel;
import android.os.Parcelable;

public class Settings implements Parcelable{

	private boolean mute;
	private boolean turnOff;
	
	public Settings(){
		mute = Const.DefaultValue.DEFAULT_SETTINGS_MUTE;
		turnOff = Const.DefaultValue.DEFAULT_SETTINGS_TURN_OFF;
	}
	
	public Settings(Parcel in) {
	      readFromParcel(in);
	}

	public void setMute(boolean mute) {
		this.mute = mute;
	}

	public boolean isMute() {
		return mute;
	}

	public void setTurnOff(boolean turnOff) {
		this.turnOff = turnOff;
	}

	public boolean isTurnOff() {
		return turnOff;
	}
	
	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
//		private boolean mute;
		if (this.mute)
			dest.writeByte((byte) 1);
		else
			dest.writeByte((byte) 0);
//		private boolean turnOff;
		if (this.turnOff)
			dest.writeByte((byte) 1);
		else
			dest.writeByte((byte) 0);
	}

	private void readFromParcel(Parcel in) {
		byte i;
//		private boolean mute;
		i=in.readByte();
		if (i==1)
			this.mute = true;
		else
			this.mute = false;
//		private boolean turnOff;
		i=in.readByte();
		if (i==1)
			this.turnOff = true;
		else
			this.turnOff = false;
	}
	
	public static final Parcelable.Creator<Settings> CREATOR
	= new Parcelable.Creator<Settings>() {
		public Settings createFromParcel(Parcel source) {
			return new Settings(source);
		}
		public Settings[] newArray(int size) {
			return new Settings[size];
		}
	};

}
